import { ui } from "../../../ui/layaMaxUI";
import UpMoveTipShow from "../Components/UpMoveTipShow";


export default class StrickNumAddTip extends ui.UIs.StrickAddTipUI {
    private beginpos:Laya.Vector2;
    private endpos:Laya.Vector2;

    private tipshow:UpMoveTipShow;
    constructor(start:Laya.Vector2,end:Laya.Vector2) {
        super();
        this.visible = true;
        this.beginpos = start;
        this.endpos = end;
    }
    createChildren(): void {
        //super.createChildren();
        this.createView(Laya.View.uiMap["UIs/StrickAddTip"]);
        //this.tipshow = this.addscoretxt.addComponent(UpMoveTipShow);
        this.visible = false;
    }

    public Show(caller:any, movefinished:Function){
        //Laya.timer.once(100,this,()=>{this.tipshow.Show(1)});
        //this.tipshow.Show(1);
        this.addscoretxt.x = this.beginpos.x + Math.random() * 100 - 50;
        this.addscoretxt.y = this.beginpos.y + Math.random() * 100 - 50;
        this.visible = true;
        Laya.Tween.to(this.addscoretxt,{x:this.endpos.x,y:this.endpos.y},1000,Laya.Ease.linearInOut,new Laya.Handler(this,()=>{
            this.visible = false;
            Laya.Pool.recover("strickaddtip",this);
            movefinished(caller);
        }));
    }
}